package com.ccjq.jq173.shosestore.order.service.impl;

import com.ccjq.jq173.shosestore.order.dao.OrderDao;
import com.ccjq.jq173.shosestore.order.dao.impl.OrderDaoImpl;
import com.ccjq.jq173.shosestore.order.po.Order;
import com.ccjq.jq173.shosestore.order.po.OrderProduct;
import com.ccjq.jq173.shosestore.order.service.OrderService;

import java.sql.Connection;
import java.util.List;
import java.util.Map;

public class OrderServiceImpl implements OrderService {
    private OrderDao orderDao=null;

    public OrderServiceImpl()
    {
        orderDao=new OrderDaoImpl();
    }
    @Override
    public boolean addOrderProduct(String orderId, String productId, int quantity, double price, Connection con) {

        return orderDao.addOrderProduct(orderId,productId,quantity,price,con);
    }

    @Override
    public boolean createOrder(Map<String, Object> order) {
        return orderDao.createOrder(order);
    }

    @Override
    public List<Order> queryAllOrders(String userId) {

        return orderDao.queryAllOrders(userId);
    }

    @Override
    public Order queryOneOrder(String orderId) {
        return orderDao.queryOneOrder(orderId);
    }

    @Override
    public List<OrderProduct> queryBuylog(String orderId) {
        return orderDao.queryBuylog(orderId);
    }

    @Override
    public List<Order> getPageList(int startRow, int pageSize, String userid) {
        return orderDao.getPageList(startRow,pageSize,userid);
    }

    @Override
    public int getCount(String userid) {
        return orderDao.getCount(userid);
    }
}
